package Controller;

import entity.Emp;
import service.EmpService;
import service.impl.EmpServiceimpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/*
 *徐韬
 *2021/9/23
 *22:06
 */
@WebServlet("/select")
public class SelectEmpController extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        Integer id1 = Integer.valueOf(id);
        EmpService empService = new EmpServiceimpl();
        Emp emp = empService.showEmp(id1);
        request.setAttribute("emp", emp);
        request.getRequestDispatcher("/updateEmp.jsp").forward(request,response);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
